﻿using System.Windows.Controls;

namespace content.A05
{
    public partial class A0502:Page
    {
        public A0502()
        {
            InitializeComponent();
            Loaded+=delegate
            {
                {
                    var d=new D();
                    d.MyMethod(2);
                    TextBlock1.Text+=d.Result;
                    var e=new E();
                    e.MyMethod(2);
                    TextBlock1.Text+=e.Result;
                }

                {
                    D d=new D();
                    d.MyMethod(2);
                    TextBlock1.Text+=d.Result;
                    D e=new E();
                    e.MyMethod(2);
                    TextBlock1.Text+=e.Result;
                }
                {
                    D d=new D();
                    d.MyMethod2(2);
                    TextBlock1.Text+=d.Result;
                    D e=new E();
                    e.MyMethod2(2);
                    TextBlock1.Text+=e.Result;
                }
                {
                    D d=new D();
                    d.MyMethod3(2);
                    TextBlock1.Text+=d.Result;
                    D e=new E();
                    e.MyMethod3(2);
                    TextBlock1.Text+=e.Result;
                }
            };
        }
    }


    public class D
    {
        public string Result{get;protected set;}="";

        public virtual void MyMethod(int num)
        {
            num+=10;
            Result+=$"{num}\n";
        }
        public void MyMethod2(int num)
        {
            num+=10;
            Result+=$"{num}\n";
        }
        public virtual void MyMethod3(int num)
        {
            num+=10;
            Result+=$"{num}\n";
        }
    }

    //（2）
    public class E:D
    {
        public override void MyMethod(int num)
        {
            num+=50;
            Result+=$"{num}\n";
        }
        public void MyMethod2(int num)
        {
            num+=50;
            Result+=$"{num}\n";
        }
        public void MyMethod3(int num)
        {
            num+=50;
            Result+=$"{num}\n";
        }
    }
}